import {memberList} from "../../request/api"
const state = {
    list:[]
}
const mutations = {
    changeList(state, val) {
        state.list=val
    }
}
const actions = {
    asyncChangeList(context) {
        memberList().then(res => {
            //bug1、如果列表中无数据(如所有数据都删除完后) 我们要手动返回一个空数组(否则会显示null)
            let arr = res.data.list ? res.data.list : [];
            context.commit("changeList", arr);
        })
    }
}
const getters = {
    list(state) {
        return state.list
    }
}
export default {
    state, mutations, actions, getters,
    namespaced:true
}